package work;

public class Student implements Comparable<Student> {
	private String name;
	private String id;
	private int score;

	public Student(String name, String id, int score) {
		super();
		this.name = name;
		this.id = id;
		this.score = score;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public Student() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		return "Student [name=" + name + ", id=" + id + ", score=" + score + "]";
	}

	public int compareTo(Student s) {
		int s1 = s.getScore() - this.getScore();
		int s2 = Integer.parseInt(this.getId()) - Integer.parseInt(this.getId());
		return s1 == 0 ? s2 : s1;
	}
}
